//
//  PinyinTool.m
//  小团购
//
//  Created by 樊荣海 on 15/1/26.
//  Copyright (c) 2015年 樊荣海. All rights reserved.
//

#import "PinyinTool.h"

@implementation PinyinTool

singleton_implementation(PinyinTool)

- (NSString *)pinyinTrans:(NSString *)chinese {
    
    NSMutableString * pinyin = [[NSMutableString alloc] initWithString:chinese];
    
    // 汉字转换为拼音,并去除音调
    if ( ! CFStringTransform((__bridge CFMutableStringRef) pinyin, nil, kCFStringTransformMandarinLatin, NO) ||
        ! CFStringTransform((__bridge CFMutableStringRef) pinyin, nil, kCFStringTransformStripDiacritics, NO)) {
        return @"";
    }
    
    return pinyin;
}


@end
